﻿<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2006" 
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
	x:Class="SmartCA.Presentation.Views.ChangeOrderView"
	xmlns:presentation="clr-namespace:SmartCA.Presentation.Views"
	Title="Change Orders"
	x:Name="changeOrdersWindow"
	Width="800" Height="600" Background="{StaticResource FormBackgroundBrush}">
	
    <Grid>
    
		<Grid.RowDefinitions>
		  <RowDefinition Height="Auto" />
		  <RowDefinition />
		  <RowDefinition Height="Auto" />
		</Grid.RowDefinitions>
		<Grid.ColumnDefinitions>
		  <ColumnDefinition Width="1*" />
		  <ColumnDefinition Width="2*" />
		</Grid.ColumnDefinitions>
		
		<Label Style="{StaticResource headerLabelStyle}" Margin="10" Grid.Row="0" Grid.Column="0">Change Orders</Label>
		<Label Style="{StaticResource headerLabelStyle}" Margin="0,10,10,10" Grid.Row="0" Grid.Column="1">Selected Change Order</Label>
		
		<ListBox Margin="10,0,10,10" Grid.Row="1" Grid.Column="0" 
			IsSynchronizedWithCurrentItem="True" 
			SelectedItem="{Binding Path=CurrentEntity}"
			ItemsSource="{Binding Path=EntitiesView}"
			DisplayMemberPath="Number"/>
			
		<Border BorderBrush="Black" BorderThickness="1" Margin="0,0,10,10" Grid.Row="1" Grid.Column="1">
			<ScrollViewer>
				<Grid>
				
					<Grid.RowDefinitions>
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
					</Grid.RowDefinitions>
					
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="Auto" />
						<ColumnDefinition Width="Auto" />
					</Grid.ColumnDefinitions>
					
					<Label Grid.Row="0" Grid.Column="0" Content="Change Order Number:" 
						Style="{StaticResource baseLabelStyle}"/>
					<TextBox Grid.Row="0" Grid.Column="1" 
						Text="{Binding Path=CurrentEntity.Number}"/>
						
					<Label Grid.Row="1" Grid.Column="0" Content="Effective Date:"
						Style="{StaticResource baseLabelStyle}"/>
					<DatePicker Grid.Row="1" Grid.Column="1" 
						SelectedDate="{Binding Path=CurrentEntity.EffectiveDate}" />
						
					<Label Grid.Row="2" Grid.Column="0" Content="Contractor:"
						Style="{StaticResource baseLabelStyle}"/>
					<ComboBox Grid.Row="2" Grid.Column="1"
						SelectedItem="{Binding Path=CurrentEntity.Contractor}"
						IsSynchronizedWithCurrentItem="True"
						ItemsSource="{Binding Path=Contractors}" 
						DisplayMemberPath="Name" />
						
					<Label Grid.Row="3" Grid.Column="0" Content="Description:" 
						Style="{StaticResource baseLabelStyle}"/>
					<TextBox Grid.Row="3" Grid.Column="1" 
						Text="{Binding Path=CurrentEntity.Description}"/>
						
					<Label Grid.Row="4" Grid.Column="0" Content="Price Change Type:"
						Style="{StaticResource baseLabelStyle}"/>
					<ComboBox Grid.Row="4" Grid.Column="1"
						SelectedItem="{Binding Path=CurrentEntity.ChangeType}"
						IsSynchronizedWithCurrentItem="True"
						ItemsSource="{Binding Path=PriceChangeTypesView}" 
						DisplayMemberPath="Name" />
						
					<Label Grid.Row="5" Grid.Column="0" Content="Price Change Direction:"
						Style="{StaticResource baseLabelStyle}"/>
					<ComboBox Grid.Row="5" Grid.Column="1"
						SelectedItem="{Binding Path=CurrentEntity.PriceChangeDirection}"
						IsSynchronizedWithCurrentItem="True"
						ItemsSource="{Binding Path=PriceChangeDirections}" />
						
					<Label Grid.Row="6" Grid.Column="0" Content="Previous Authorized Change Order Amount:" 
						Style="{StaticResource baseLabelStyle}"/>
					<Label Grid.Row="6" Grid.Column="1" Content="{Binding Path=CurrentEntity.PreviousAuthorizedAmount}" 
						Style="{StaticResource baseLabelStyle}"/>
						
					<Label Grid.Row="7" Grid.Column="0" Content="Amount Changed:" 
						Style="{StaticResource baseLabelStyle}"/>
					<TextBox Grid.Row="7" Grid.Column="1" 
						Text="{Binding Path=CurrentEntity.AmountChanged}"/>
						
					<Label Grid.Row="8" Grid.Column="0" Content="Time Change Direction:"
						Style="{StaticResource baseLabelStyle}"/>
					<ComboBox Grid.Row="8" Grid.Column="1"
						SelectedItem="{Binding Path=CurrentEntity.TimeChangeDirection}"
						IsSynchronizedWithCurrentItem="True"
						ItemsSource="{Binding Path=TimeChangeDirections}" />
						
					<Label Grid.Row="9" Grid.Column="0" Content="Previous Time Changed Total:" 
						Style="{StaticResource baseLabelStyle}"/>
					<Label Grid.Row="9" Grid.Column="1" Content="{Binding Path=CurrentEntity.PreviousTimeChangedTotal}" 
						Style="{StaticResource baseLabelStyle}"/>
						
					<Label Grid.Row="10" Grid.Column="0" Content="Time Changed:" 
						Style="{StaticResource baseLabelStyle}"/>
					<TextBox Grid.Row="10" Grid.Column="1" 
						Text="{Binding Path=CurrentEntity.TimeChanged}"/>
					
					<Label Grid.Row="11" Grid.Column="0" Content="Routing:"
						Style="{StaticResource baseLabelStyle}"/>
					<presentation:RoutingItems Grid.Row="11" Grid.Column="1" 
						DataContext="{Binding Path=RoutingItems}"/>
						
					<Label Grid.Row="12" Grid.Column="0" Content="Status:" 
						Style="{StaticResource baseLabelStyle}"/>
					<ComboBox Grid.Row="12" Grid.Column="1"
						ItemsSource="{Binding Path=Statuses}"
						DisplayMemberPath="Status"
						SelectedItem="{Binding Path=CurrentEntity.Status}">				
					</ComboBox>
					
					<Label Grid.Row="13" Grid.Column="0" Content="Agency Approved Date:"
						Style="{StaticResource baseLabelStyle}"/>
					<DatePicker Grid.Row="13" Grid.Column="1" 
						SelectedDate="{Binding Path=CurrentEntity.AgencyApprovedDate}" />
						
					<Label Grid.Row="14" Grid.Column="0" Content="Date to Field:"
						Style="{StaticResource baseLabelStyle}"/>
					<DatePicker Grid.Row="14" Grid.Column="1" 
						SelectedDate="{Binding Path=CurrentEntity.DateToField}" />
						
					<Label Grid.Row="15" Grid.Column="0" Content="Owner Signature Date:"
						Style="{StaticResource baseLabelStyle}"/>
					<DatePicker Grid.Row="15" Grid.Column="1" 
						SelectedDate="{Binding Path=CurrentEntity.OwnerSignatureDate}" />
						
					<Label Grid.Row="16" Grid.Column="0" Content="Architect Signature Date:"
						Style="{StaticResource baseLabelStyle}"/>
					<DatePicker Grid.Row="16" Grid.Column="1" 
						SelectedDate="{Binding Path=CurrentEntity.ArchitectSignatureDate}" />
						
					<Label Grid.Row="17" Grid.Column="0" Content="Contractor Signature Date:"
						Style="{StaticResource baseLabelStyle}"/>
					<DatePicker Grid.Row="17" Grid.Column="1" 
						SelectedDate="{Binding Path=CurrentEntity.ContractorSignatureDate}" />
							
			</Grid>
		  </ScrollViewer>
		</Border>
		
		<Button HorizontalAlignment="Right" Margin="10,0,10,10" Grid.Row="2" Grid.Column="0" Command="{Binding Path=NewCommand}">New</Button>
		<StackPanel HorizontalAlignment="Right" Orientation="Horizontal" Grid.Row="2" Grid.Column="1">
		  <Button Grid.Row="2" Margin="10,0,10,10" Grid.Column="0" Command="{Binding Path=SaveCommand}">Save</Button>
		  <Button Grid.Row="2" Margin="0,0,10,10" Grid.Column="0" Command="{Binding Path=CancelCommand}">Cancel</Button>
		</StackPanel>
        
    </Grid>
    
</Window>